package com.qf.smartdevice.controller;

import com.github.pagehelper.PageInfo;
import com.qf.smartdevice.dto.R;
import com.qf.smartdevice.pojo.Devices;
import com.qf.smartdevice.service.IDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/devices")
public class DeviceController {
    @Autowired
    private IDeviceService deviceService;
    @GetMapping("/devices")
    public R findAllDevices(@RequestParam(defaultValue = "1") int page,@RequestParam(defaultValue = "10") int limit){
        PageInfo<Devices> pageInfo = deviceService.findAllDevice(page, limit);
        return R.setOK(pageInfo);
    }
}
